from Data import Data
from MetaData import MetaData,MetaDataFactory
import activist.Time

class Text(Data):
    def __init__(self,expectedid=None):
        super(Text,self).__init__(expectedid)
        self.command("create")
        
    command_create_VERSION = 0
    def command_create(self,content,creator=None):
        self._createcalled = True
        self._content = content
        
        if creator:
            MetaDataFactory(self,MetaData.Creator,creator)

    def content(self):
        return self._content

    def getXML(self):
        return """
<text class="activist.Text" id="%(id)s">
  <content>%(content)s</content>
%(meta)s
</text>
        """ % { "content": self.content(),
                "id":self.id(),
                "meta":self.getMetaXML()
                }

    def __str__(self):
        return '<Text %s>' % self.id()
